
function cambiar_login() {
	document.querySelector('.cont_forms').className = "cont_forms cont_forms_active_login";
	document.querySelector('.cont_form_login').style.display = "block";
	document.querySelector('.cont_form_sign_up').style.opacity = "0";

	setTimeout(function() {
		document.querySelector('.cont_form_login').style.opacity = "1";
	}, 400);

	setTimeout(function() {
		document.querySelector('.cont_form_sign_up').style.display = "none";
	}, 200);
}

function cambiar_login2() {
	var username = document.getElementById("username").value;
	var password = document.getElementById("password").value;
	if (username == "") {
		alert("用户名不能为空");
		return false;
	} else if ((username < 5) || (username.length > 20)) {
		alert("用户名必须为5 ~ 20位");
		return false
	} else if (check_other_char(username)) {
		alert("用户名不能含有特殊字符");
		return false;
	}

	if (password == "") {
		alert("密码不能为空");
		return false;
	} else if ((password.length < 5) || (password.length > 10)) {
		alert("密码必须为6 ~ 10位");
		return false
	} else if (check_other_char(password)) {
		alert("密码不能含有特殊字符");
		return false;
	}
}

function cambiar_sign_up(at) {
	document.querySelector('.cont_forms').className = "cont_forms cont_forms_active_sign_up";
	document.querySelector('.cont_form_sign_up').style.display = "block";
	document.querySelector('.cont_form_login').style.opacity = "0";

	setTimeout(function() {
		document.querySelector('.cont_form_sign_up').style.opacity = "1";
	}, 100);

	setTimeout(function() {
		document.querySelector('.cont_form_login').style.display = "none";
	}, 400);

}

function ocultar_login_sign_up() {

	document.querySelector('.cont_forms').className = "cont_forms";
	document.querySelector('.cont_form_sign_up').style.opacity = "0";
	document.querySelector('.cont_form_login').style.opacity = "0";

	setTimeout(function() {
		document.querySelector('.cont_form_sign_up').style.display = "none";
		document.querySelector('.cont_form_login').style.display = "none";
	}, 500);

}

function cambiar_sign_up2() {
	var username = document.getElementById("reusername").value;
	var password = document.getElementById("repassword").value;
	var conpassword = document.getElementById("conpassword").value;

	if (username == "") {
		alert("用户名不能为空");
		return false;
	} else if ((username < 5) || (username.length > 20)) {
		alert("用户名必须为5 ~ 20位");
		return false
	} else if (check_other_char(username)) {
		alert("用户名不能含有特殊字符：& , \\  , / ,  * ,  > ,  < ,  @ ,  !");
		return false;
	}

	if (password == "") {
		alert("密码不能为空");
		return false;
	} else if ((password.length < 5) || (password.length > 10)) {
		alert("密码必须为6 ~ 10位");
		return false
	} else if (check_other_char(password)) {
		alert("密码不能含有特殊字符：& , \\  , / ,  * ,  > ,  < ,  @ ,  !");
		return false;
	}

	if (password != conpassword) {
		alert("两次密码不一致，请重新输入...");
		return false;
	}
}

// 验证用户名和密码是否含有特殊字符
function check_other_char(str) {
	var arr = [ "&", "\\", "/", "*", ">", "<", "@", "!" ];
	for (var i = 0; i < arr.length; i++) {
		for (var j = 0; j < str.length; j++) {
			if (arr[i] == str.charAt(j)) {
				return true;
			}
		}
	}
	return false;
}

function check_money() {
	var smoney = document.getElementById("money").value;

	if (smoney == "") {
		alert("存款金额不能为空");
		return false;
	} else if (check_money_char(smoney)) {
		alert("存款金额不能为负数或含有特殊字符");
		return false;
	}
}

// 验证存款金额是否含有特殊字符
/*function check_money_char(smoney) {
	var arr = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" ];
	for (var i = 0; i < arr.length; i++) {
		for (var j = 0; j < smoney.length; j++) {
			if (arr[i] != smoney.charAt(j)) {
				return false;
			}
			else if(arr[i] == '-'){
				return false;
			}
		}
	}
}*/
